// public/summary.js
const SUMMARY = [
  {
    name: "快速开始",
    icon: "ReadOutlined",
    path: "<HOST>/docs/index",
  },
  {
    name: "项目结构",
    icon: "ApartmentOutlined",
    path: "<HOST>/docs/quick/struct",
  },
  {
    name: "SDK命令指引",
    icon: "CodeOutlined",
    path: "<HOST>/docs/quick/command",
  },
  {
    name: "更新日志",
    icon: "StockOutlined",
    path: "<HOST>/docs/quick/update",
  },
  {
    name: "SLK",
    icon: "CodeSandboxOutlined",
    children: [
      {
        name: "Slk入门",
        icon: "InboxOutlined",
        path: "<HOST>/docs/lib/hslk1",
      },
      {
        name: "Slk进阶",
        icon: "InboxOutlined",
        path: "<HOST>/docs/lib/hslk2",
      },
      {
        name: "Slk原生物编字段",
        icon: "TableOutlined",
        path: "<HOST>/docs/lib/hslk_f6",
      },
      {
        name: "Slk与MISC数据",
        icon: "TableOutlined",
        path: "<HOST>/docs/lib/hslk_misc",
      },
      {
        name: "Slk与Excel",
        icon: "FileExcelOutlined",
        path: "<HOST>/docs/lib/hslk_excel",
      },
    ],
  },
  {
    name: "功能库",
    icon: "DropboxOutlined",
    children: [
      {
        name: "API",
        icon: "DeploymentUnitOutlined",
        path: "<HOST>/docs/lib/api",
      },
      {
        name: "BJ",
        icon: "BoldOutlined",
        path: "<HOST>/docs/lib/bj",
      },
      {
        name: "CJ",
        icon: "CopyrightOutlined",
        path: "<HOST>/docs/lib/cj",
      },
      {
        name: "属性 Attr",
        icon: "FontColorsOutlined",
        path: "<HOST>/docs/lib/attr",
      },
      {
        name: "JAPI",
        icon: "PullRequestOutlined",
        path: "<HOST>/docs/lib/japi",
      },
      {
        name: "Sync同步",
        icon: "CloudSyncOutlined",
        path: "<HOST>/docs/lib/sync",
      },
      {
        name: "Color文本颜色",
        icon: "FormatPainterOutlined",
        path: "<HOST>/docs/lib/color",
      },
    ],
  },
  {
    name: "例子",
    icon: "BuildOutlined",
    children: [
      {
        name: "自定义Attr属性",
        icon: "FontColorsOutlined",
        path: "<HOST>/docs/example/attr",
      },
      {
        name: "使用排行榜",
        icon: "OrderedListOutlined",
        path: "<HOST>/docs/example/leaderBoard",
      },
      {
        name: "使用多面板",
        icon: "BoxPlotOutlined",
        path: "<HOST>/docs/example/multiBoard",
      },
      {
        name: "难度选择对话框",
        icon: "UngroupOutlined",
        path: "<HOST>/docs/example/dialog",
      },
      {
        name: "常见两种选英雄",
        icon: "CheckSquareOutlined",
        path: "<HOST>/docs/example/pickHero",
      },
      {
        name: "简单刷兵",
        icon: "LoginOutlined",
        path: "<HOST>/docs/example/attack",
      },
      {
        name: "动态箭矢",
        icon: "ArrowRightOutlined",
        path: "<HOST>/docs/example/missile",
      },
    ],
  },
  {
    name: "其他学习",
    icon: "QuestionCircleOutlined",
    children: [
      {
        name: "Jetbrain设置",
        icon: "StarOutlined",
        path: "<HOST>/docs/other/jetbrain",
      },
      {
        name: "询问的技巧",
        icon: "MessageOutlined",
        path: "<HOST>/docs/other/q_a",
      },
      {
        name: "平台上线须知",
        icon: "CloudUploadOutlined",
        path: "<HOST>/docs/other/dz",
      },
      {
        name: "魔兽作图小技巧",
        icon: "BgColorsOutlined",
        path: "<HOST>/docs/other/war3_tec",
      },
      {
        name: "魔兽地形贴图路径",
        icon: "FundOutlined",
        path: "<HOST>/docs/other/war3_terrainArt",
      },
      {
        name: "魔兽常见崩溃原因",
        icon: "BugOutlined",
        path: "<HOST>/docs/other/war3_crash",
      },
      {
        name: "YDLua引擎",
        icon: "DashboardOutlined",
        path: "<HOST>/docs/other/lua_engine",
      },
      {
        name: "UI & FDF",
        icon: "HighlightOutlined",
        path: "<HOST>/docs/other/ui_fdf",
      },
    ],
  },
  {
    name: "小小专栏",
    icon: "RedditOutlined",
    children: [
      {
        name: "基础指令介绍",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1nV411J7FB",
      },
      {
        name: "hslk高级用法演示1",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1TK4y1Z7eB",
      },
      {
        name: "hslk高级用法演示2",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1M64y117sB",
      },
      {
        name: "hslk高级用法演示3",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1ZV411J7JJ",
      },
      {
        name: "UI之sync演示",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1iv411L7CP",
      },
      {
        name: "构建酒馆与小地图UI显示头像",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1Hy4y1s7cj",
      },
      {
        name: "伤害排行榜",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/BV1Lh411v7pR",
      },
      {
        name: "高端演示",
        icon: "VideoCameraOutlined",
        path: "<HOST>/docs/xxqq/upscale",
      },
    ],
  },
];

const s2 = [
  { key: 'index', label: "快速开始" },
  { key: 'struct', label: "项目结构" },
  { key: 'cmd', label: "命令工具" },
  { key: 'update', label: "更新日志" },
  { key: 'printd', label: "调试打印" },
  { key: 'api', label: "API" },
  {
    key: 'slk', label: "SLK", children: [
      { key: 'hslk1', label: "入门" },
      { key: 'hslk2', label: "进阶" },
      { key: 'f6', label: "原生物编字段" },
      { key: 'misc', label: "MISC数据" },
      { key: 'setData', label: "设置数据" },
      { key: 'excel', label: "Excel" },
    ]
  },
  {
    key: 'lib', label: "功能库", children: [
      { key: 'bj', label: "BJ" },
      { key: 'cj', label: "CJ" },
      { key: 'japi', label: "JAPI(本地)" },
      { key: 'japi_dz', label: "JAPI(DZ)" },
      { key: 'attr', label: "属性" },
      { key: 'sync', label: "同步" },
      { key: 'color', label: "文本颜色" },
    ]
  },
  {
    key: 'setup', label: "预设套路", children: [
      { key: 'attr', label: "自定义属性" },
      { key: 'attrThree', label: "三围属性影响" },
      { key: 'damaging', label: "伤害流" },
      { key: 'eventReaction', label: "事件反应" },
      { key: 'quest', label: "任务" },
      { key: 'cmd', label: "命令" },
    ]
  },
  {
    key: 'example', label: "例子", children: [
      { key: 'dialog', label: "难度选择对话框" },
      { key: 'attack', label: "简单刷兵" },
      { key: 'pickHero', label: "常见两种选英雄" },
    ]
  },
  {
    key: 'other', label: "其他学习", children: [
      { key: 'jetbrain', label: "Jetbrain设置" },
      { key: 'q_a', label: "询问的技巧" },
      { key: 'dz', label: "平台上线须知" },
      { key: 'war3_tec', label: "魔兽作图小技巧" },
      { key: 'war3_terrainArt', label: "魔兽地形贴图路径" },
      { key: 'war3_crash', label: "魔兽常见崩溃原因" },
      { key: 'lua_engine', label: "YDLua引擎" },
      { key: 'ui_fdf', label: "FDF" },
    ]
  },
]


const fs = require("fs");

//   生成mdbook
// console.log(SUMMARY);
let summaryMd = "# h-lua-sdk-doc";

s2.forEach(e => {
  summaryMd += "\n";
  summaryMd += `- [${e.label}](${e.key ? e.key + '.md' : ''})`;
  if (e.children) {
    e.children.forEach(c => {
      summaryMd += "\n";
      summaryMd += `  - [${c.label}](${c.key ? e.key + '\\' + c.key + '.md' : ''})`;
    })
  }
})


// console.log(summaryMd);
fs.writeFile("../src/SUMMARY.md", summaryMd, (err) => {
  if (err) {
    console.log("summary", err)
  } else {
    console.log("summary", "ok")
  }
});

let pdfMd = "README h-lua-sdk-doc";

s2.forEach(e => {
  pdfMd += "\n";
  pdfMd += `:[${e.label}](${e.key ? e.key + '.md' : ''})`;
  if (e.children) {
    e.children.forEach(c => {
      pdfMd += "\n";
      pdfMd += `:[${c.label}](${c.key ? e.key + '\\' + c.key + '.md' : ''})`;
    })
  }
})


// console.log(pdfMd);
fs.writeFile("../src/pdf.md", summaryMd, (err) => {
  if (err) {
    console.log("pdf", err)
  } else {
    console.log("pdf", "ok")
  }
});

console.log("ok")